package com.jetgege.convenientbox;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.jetgege.convenientbox.Base.BaseActivity;
import com.jetgege.convenientbox.CustomView.SlidingMenu;
import com.jetgege.convenientbox.Tools.Common;

public class MainActivity extends BaseActivity {

    SlidingMenu sm_MainView;
    RelativeLayout rl_MainToolBar;
    ImageView iv_MainLeftBG;
    @Override
    protected int getLayoutId() {return R.layout.activity_main;}
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes();
            localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags);
        }
        setupUI();

    }

    private void setupUI()
    {
        sm_MainView = (SlidingMenu) findViewById(R.id.sm_MainView);
        rl_MainToolBar=(RelativeLayout)findViewById(R.id.rl_MainToolBar);
        iv_MainLeftBG=(ImageView) findViewById(R.id.iv_MainLeftBG);
        Resources res=getResources();

        Bitmap bmp= BitmapFactory.decodeResource(res, R.drawable.left_bg);
        Common.setBgBlur(iv_MainLeftBG,bmp);
    }


    void onClickBtn(View v)
    {
        switch (v.getId())
        {
            case R.id.ib_MainToolbar:
                sm_MainView.toggle();
                break;
            case R.id.rl_MainRightView:
                sm_MainView.closeMenu();
                break;

        }
    }



}
